from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

dirver_path = r"C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
driver = webdriver.Chrome(executable_path=dirver_path)
driver.get("https://www.baidu.com")

inputTag = driver.find_element_by_id('kw')
submitTag = driver.find_element_by_id('su')


actions = ActionChains(driver) #创建行为对象
actions.move_to_element(inputTag)
actions.send_keys_to_element(inputTag,'苍老师')
actions.move_to_element(submitTag)
actions.click(submitTag)
actions.perform() #规定好以上行为链 然后开始执行
